package com.zcl.javaClassAndObject.collection.typeUnknown8_2_1;

import java.util.Vector;

/**
 * @Description:
 * @author: zcl
 * @date: 2021/12/13  10:48
 */
public class CatsAndDogs {
    public static void main(String[] args) {
        Vector cats = new Vector();
        for (int i = 0; i < 7; i++) {
            cats.addElement(new Cat(i));
        }
        cats.addElement(new Dog(7));
        for (int i = 0; i < cats.size(); i++) {
            System.out.println((Cat)cats.elementAt(i));
        }
    }
}
/**
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@4554617c
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@74a14482
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@1540e19d
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@677327b6
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@14ae5a5
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@7f31245a
 * com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat@6d6f6e28
 * Exception in thread "main" java.lang.ClassCastException: com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Dog cannot be cast to com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.Cat
 * 	at com.zcl.javaClassAndObject.collection.typeUnknown8_2_1.CatsAndDogs.main(CatsAndDogs.java:19)
 * **/